<?php
	echo $this->Html->css(array('jquery.ui.button','jquery.ui.position','jquery.ui.autocomplete'));
	echo $this->Html->script(array('jquery.ui.button','jquery.ui.position','jquery.ui.autocomplete','autocombo')); 
?>
<script>
	$(function() {
		$( "#canbo_id" ).combobox();
		
	});

	function validate()
	{
		if($("#canbo_id" ).val()=='')
		{
			alert('Bạn chưa chọn Cán bộ');
			return false;
		}
		if($("#thanhtich" ).val()=='')
		{
			alert('Bạn chưa nhập thành tích');
			return false;
		}
		return true;
	}
	</script>
  <script>
$(function() {
	$( "#tabs" ).tabs({
	    select: function(event, ui) {
	        var url = $.data(ui.tab, 'load.tabs');
	        if( url ) {
	            location.href = url;
	            return false;
	        }
	        return true;
	    },
	selected: 1
	});
});
</script>
<div id="tabs">
	<ul>
          <li><?php echo $this->Html->link(__('Thành tích cán bộ', true), array('controller'=>'thanhtichkhoacbs','action'=>'index',$phongtrao['Phongtraokhoa']['id'])); ?></li>
             <li><a href='#ttcbe'>Cập nhật thành tích</a> </li>
    </ul>
<div class="thanhtichsvs form" id="ttcbe">
<?php echo $this->Form->create('Thanhtichkhoacb',array('onsubmit'=>'return validate()','url'=>array('action'=>'edit',$this->data['Thanhtichkhoacb']['id'],$phongtrao_id)));?>
<?php echo $form->input('id');?>
<table id='tables'>
	<tr><th>Cán bộ</th>  <th>Thành tích</th>  <th>Ghi chú</th>   <th>Thao tác</th></tr>
	<tr>
		<td><?php
					echo $form->input('chidoan_id',array('id'=>'chidoan_id','label'=>false,'options'=>$chidoans,'type'=>'select','empty'=>' -- Tất cả -- '));?>
			<div id='canbo'>
			<?php
				 echo $form->input('canbo_id',array('id'=>'canbo_id','label'=>false,'type'=>'select','options'=>$canbos,'empty'=>'Chọn Cán bộ'));
			?>
			</div>
		</td>
		<td><?php echo $form->input('thanhtichkhoacb',array('id'=>'thanhtich','label'=>false,'type'=>'text'));?></td>
		<td><?php echo $form->input('ghichu',array('id'=>'','label'=>false,'type'=>'textarea'));?></td>
		<td><?php echo $form->end(' Lưu  ');?></td>
	</tr>
</table>
</div>
</div>
<?php
$this->Js->get('#chidoan_id')->event('change',
							$this->Js->request(array('controller' => 'thanhtichkhoacbs', 'action' => 'laycanbo',$phongtrao_id),
							array('update' => '#canbo','async' => true,
							'dataExpression' => true,'method' => 'post',
							'data' => $js->serializeForm(array('isForm' => false, 'inline' => true))))); 
?>